package com.net;

import java.net.InetAddress;
import java.net.NetworkInterface;
import java.util.Enumeration;

/**
 * @Author : hebad90@163.com
 * @Date : 2014/10/23 7:59
 * @From : javalearn
 */
public class NetworkInterfaceTest {
    public static void main(String[] args) throws Exception{
       Enumeration<NetworkInterface> eis = NetworkInterface.getNetworkInterfaces();
       while(eis.hasMoreElements()){
           NetworkInterface ei = eis.nextElement();
           System.out.println(ei.getName()+","+ei.getDisplayName()+"----------");
           Enumeration<InetAddress> e = ei.getInetAddresses();
           while(e.hasMoreElements()){
               System.out.println("     "+e.nextElement());
           }
       }
    }
}
